package com.google.code.myowndatabase.meta;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class TableMetaData {

    public final String name;
    public final List<ColumnMetaData> columns;

    public TableMetaData(String name, List<ColumnMetaData> columns) {
        this.name = name;
        this.columns = Collections.unmodifiableList(columns);
    }
    
    public static Builder builder(String name) {
        return new Builder(name);
    }

    public static class Builder {
        
        private final String name;
        private final List<ColumnMetaData> columns = new ArrayList<ColumnMetaData>();

        public Builder(String name) {
            this.name = name;
        }

        public Builder addColumn(ColumnMetaData column) {
            columns.add(column);
            return this;
        }

        public TableMetaData build() {
            return new TableMetaData(name, columns);
        }
        
    }
    
}
